Integrating FastSpring and Wishlist Member

I’m using Wishlist Member on a membership site I run (I don’t particularly recommend using it). So far, I’ve been handling the payments myself through PayPal, which works ok.

However, next year I’m headed into trouble, as EU VAT system changes. So far I’ve charged Finnish VAT from all EU users without a VAT id. From 2015 onwards, I’ll have to charge them their local VAT, and report it to the local tax office. My accountant didn’t like that, and I agree: considering my volumes, it’s more trouble than it’s worth.

Outsourcing payment processing

Enter a solution: I decided to outsource the whole payment process to FastSpring. I’m currently waiting for them to activate my new store, so I have no idea how well it actually works, but so far it seems like a win: it’s more expensive than just PayPal, but I’ll save lots of money when my accountant doesn’t have to handle dozens of PayPal payments every month, just two payments from FastSpring.

(Update May 2017: I’ve left FastSpring a while ago to Paddle. It’s slightly cheaper and has much better service. It also needs a similar bridge to link with Wishlist Member. If you’re interested in that, feel free to contact me.)

Now, the problem is: how to integrate FastSpring with Wishlist Member? Of course Wishlist Member doesn’t support FastSpring directly. That would be too simple. Only search results on topic are people asking for a freelancer to build the integration for them.

Well, it can’t be that difficult, can it?

Solution

Wishlist Member has support for generic shopping carts. That’s what we’ll use here. Download the integration instructions and note the post URL and secret word.

In SpringBoard, you have notifications, which are designed for exactly this. Unfortunately – notifications from SpringBoard do not work directly with Wishlist Member: WL expects certain method of encrypting, which SpringBoard cannot do.

We solve this with a bridge. Create a PHP file that SpringBoard notifies, then have that file notify Wishlist Member. Problem almost solved! The thing is, Wishlist Member wants to redirect the user to a page where they can complete the registration. You can’t do that with our bridge here, so the solution is to have the bridge email the account completion URL to the user.

Then just have SpringBoard notify the PHP file when someone completes an order (send the order information as a POST request containing name/value pairs).

Some PHP code

How does it look like in code, then? Here’s my PHP file:

<?php

$privatekey = 'SPRINGBOARD PRIVATE KEY';

if (md5($_REQUEST['security_data'] . $privatekey)
!= $_REQUEST['security_hash']){
return;}

$postURL = 'WISHLIST MEMBER POST URL';
$secretKey = 'WISHLIST MEMBER SECRET WORD';

$data = array ();
$data['cmd'] = 'CREATE';
$data['transaction_id'] = $_REQUEST['OrderID'];
$data['lastname'] = $_REQUEST['CustomerLastName'];
$data['firstname'] = $_REQUEST['CustomerFirstName'];
$data['email'] = $_REQUEST['CustomerEmail'];

/* I have two user levels: this sets the correct level based on the product purchased. */
if (strpos($_REQUEST['OrderProductNames'], 'Standard') === true) {
    $data['level'] = 'WISHLIST LEVEL SKU';
}
else {
    $data['level'] = 'WISHLIST LEVEL SKU';
}

$delimiteddata = strtoupper (implode ('|', $data));
$hash = md5 ($data['cmd'] . '__' . $secretKey . '__' . $delimiteddata);
$data['hash'] = $hash;
$ch = curl_init ($postURL);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$returnValue = curl_exec ($ch);
// process return value
list ($cmd, $url) = explode ("\n", $returnValue);
// check if the returned command is the same as what we passed

$message = <<<EOH
Create your account here:
$url
EOH;

$headers = 'From: Your Name <you@example.com>' . "\r\n" .
'Reply-To: you@example.com' . "\r\n";

if ($cmd == 'CREATE') {
    mail($data['email'], 'Create your account', $message, $headers);
    exit;
} else {
    die ('Error');
}

There’s lots of fine detail and different cases that could be covered here, but this handles the basics of integrating Wishlist Member and FastSpring.

1 kommentti kirjoitukseen “Integrating FastSpring and Wishlist Member

  1. Thank you for posting this. I’ve been using clickbank to avoid this problem in the past, but giving recent policy changes at their company, I’ll have to look for an alternative.

    I also looked at Gumroad and Shopify, but both route their payments through Paypal (if you’re based in the EU), which adds another layer of fees and the permanent risk of having your money frozen, neither of which I’m particularly fond of. Just like with FastSpring, you don’t have to deal with VAT at all (yay!).

    Another alternative others may find useful is using quaderno. They require a stripe account, which can wire money directly into your bank account even if you’re in the EU (gumroad and shopify don’t do that) *BUT* the big issue is that all VAT collected goes into your account and you have to remit it to the individual countries or your government *AND* keep records on who purchased what from where (= nightmare). It’s a good solution for bigger companies that don’t have a problem with record keeping.

Vastaa

Sähköpostiosoitettasi ei julkaista. Pakolliset kentät on merkitty *

This site uses Akismet to reduce spam. Learn how your comment data is processed.